package com.pwc.workQueue;

import com.pwc.utils.RabbitUtil;
import com.rabbitmq.client.Channel;
import com.rabbitmq.client.MessageProperties;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

public class ProducerMessageLost {
    private final static String QUEUE_NAME = "aaa";

    public static void main(String[] args) throws IOException, TimeoutException {
        Channel channel = RabbitUtil.createChannel();
        for (int i = 0; i < 10; i++) {
            String str = "消息---" + i;
            //MessageProperties.PERSISTENT_TEXT_PLAIN 消息持久化
            channel.basicPublish("", QUEUE_NAME, MessageProperties.PERSISTENT_TEXT_PLAIN, str.getBytes());
        }

    }
}
